{{include file="header_inc.html"}}
<style type="text/css">
.guery {
	background: url({{#siteImgPath#}}/msg_img/msg_bg.png) no-repeat 0px
		-560px;
	padding: 10px 12px 10px 45px;
	font-size: 14px;
	height: 100px;
	line-height: 96px
}

.guery {
	background-position: left -460px;
}
</style>
<body>
	{{if $roleid}}
	<div class="table-list" id="load_priv">
		<table width="100%" cellspacing="0">
			<thead>
				<tr>
					<th class="text-l cu-span" style='padding-left: 30px;'><span
						onClick="cleck_all();"> 全选 </span>/<span onClick="cleck_cancel();">
							取消 </span></th>
				</tr>
			</thead>
		</table>
		<form name="myform" action="/setting/rolemanage/rolepriv/"
			method="post">
			<input type="hidden" name="roleid" value="{{$roleid}}"></input>
			<table width="100%" cellspacing="0" id="dnd-example">
				<tbody>{{$categorys}}
				</tbody>
			</table>
			<div class="btn">
				<input type="submit" class="button" name="dosubmit" id="dosubmit"
					value="提 交" />
			</div>
		</form>
	</div>
	{{else}}
	<center>
		<div class="guery"
			style="display: inline-block; display: -moz-inline-stack; zoom: 1; *display: inline;">请选择角色！</div>
	</center>
	{{/if}}
</body>
<script type="text/javascript">
	function cleck_all() {
		$("input[name='menuid[]']").each(function() {
			$(this).attr("checked", true);
		})
	}
	function cleck_cancel() {
		$("input[name='menuid[]']").each(function() {
			$(this).attr("checked", false);
		})
	}
	$(document).ready(function() {
		$("#dnd-example").treeTable({
			indent : 20
		});
	});
	function checknode(obj) {
		var chk = $("input[type='checkbox']");
		var count = chk.length;
		var num = chk.index(obj);
		var level_top = level_bottom = chk.eq(num).attr('level')
		for ( var i = num; i >= 0; i--) {
			var le = chk.eq(i).attr('level');
			if (eval(le) < eval(level_top)) {
				chk.eq(i).attr("checked", true);
				var level_top = level_top - 1;
			}
		}
		for ( var j = num + 1; j < count; j++) {
			var le = chk.eq(j).attr('level');
			if (chk.eq(num).attr("checked") == true) {
				if (eval(le) > eval(level_bottom))
					chk.eq(j).attr("checked", true);
				else if (eval(le) == eval(level_bottom))
					break;
			} else {
				if (eval(le) > eval(level_bottom))
					chk.eq(j).attr("checked", false);
				else if (eval(le) == eval(level_bottom))
					break;
			}
		}
	}
</script>
{{include file="footer.html"}}
